WPS Office.apk(点击下载) / CreateOneLinkHttpTask.java


package com.appsflyer;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.WorkerThread;
import com.appsflyer.share.Constants;
import com.appsflyer.share.LinkGenerator;
import com.google.firebase.perf.FirebasePerformance;
import com.iflytek.cloud.SpeechEvent;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONException;
import org.json.JSONObject;

public class CreateOneLinkHttpTask extends OneLinkHttpTask {

    /* renamed from: ʻ  reason: contains not printable characters */
    private Context f89;

    /* renamed from: ˊ  reason: contains not printable characters */
    private ResponseListener f90;

    /* renamed from: ˋ  reason: contains not printable characters */
    private Map<String, String> f91;

    /* renamed from: ˎ  reason: contains not printable characters */
    private String f92 = "";

    /* renamed from: ˏ  reason: contains not printable characters */
    private String f93;

    /* renamed from: ॱॱ  reason: contains not printable characters */
    private boolean f94 = false;

    public interface ResponseListener {
        @WorkerThread
        void onResponse(String str);

        @WorkerThread
        void onResponseError(String str);
    }

    public CreateOneLinkHttpTask(@NonNull String str, @NonNull Map<String, String> map, AppsFlyerLib appsFlyerLib, @NonNull Context context, boolean z) {
        super(appsFlyerLib);
        this.f94 = z;
        this.f89 = context;
        if (this.f89 != null) {
            this.f92 = context.getPackageName();
        } else {
            AFLogger.afWarnLog("CreateOneLinkHttpTask: context can't be null");
        }
        this.f97 = str;
        this.f93 = "-1";
        this.f91 = map;
    }

    public void setListener(@NonNull ResponseListener responseListener) {
        this.f90 = responseListener;
    }

    /* access modifiers changed from: package-private */
    @Override // com.appsflyer.OneLinkHttpTask
    /* renamed from: ˊ  reason: contains not printable characters */
    public final String m91() {
        return new StringBuilder().append(ServerConfigHandler.getUrl("https://onelink.%s/shortlink-sdk/v1")).append("/").append(this.f97).toString();
    }

    /* access modifiers changed from: package-private */
    @Override // com.appsflyer.OneLinkHttpTask
    /* renamed from: ˊ  reason: contains not printable characters */
    public final void m92(HttpsURLConnection httpsURLConnection) throws JSONException, IOException {
        if (!this.f94) {
            httpsURLConnection.setRequestMethod(FirebasePerformance.HttpMethod.POST);
            httpsURLConnection.setDoInput(true);
            httpsURLConnection.setDoOutput(true);
            httpsURLConnection.setUseCaches(false);
            JSONObject jSONObject = new JSONObject();
            JSONObject jSONObject2 = new JSONObject(this.f91);
            jSONObject.put("ttl", this.f93);
            jSONObject.put(SpeechEvent.KEY_EVENT_RECORD_DATA, jSONObject2);
            httpsURLConnection.connect();
            DataOutputStream dataOutputStream = new DataOutputStream(httpsURLConnection.getOutputStream());
            dataOutputStream.writeBytes(jSONObject.toString());
            dataOutputStream.flush();
            dataOutputStream.close();
        }
    }

    /* access modifiers changed from: package-private */
    @Override // com.appsflyer.OneLinkHttpTask
    /* renamed from: ˋ  reason: contains not printable characters */
    public final void m93() {
        LinkGenerator addParameters = new LinkGenerator(Constants.USER_INVITE_LINK_TYPE).setBaseURL(this.f97, AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.ONELINK_DOMAIN), this.f92).addParameter(Constants.URL_SITE_ID, this.f92).addParameters(this.f91);
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID);
        if (string != null) {
            addParameters.setReferrerCustomerId(string);
        }
        this.f90.onResponse(addParameters.generateLink());
    }

    /* access modifiers changed from: package-private */
    @Override // com.appsflyer.OneLinkHttpTask
    /* renamed from: ॱ  reason: contains not printable characters */
    public final void m94(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            Iterator<String> keys = jSONObject.keys();
            while (keys.hasNext()) {
                this.f90.onResponse(jSONObject.optString(keys.next()));
            }
        } catch (JSONException e) {
            this.f90.onResponseError("Can't parse one link data");
            AFLogger.afErrorLog("Error while parsing to json ".concat(String.valueOf(str)), e);
        }
    }
}